<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>购物车</title>
		<link rel="stylesheet" type="text/css" href="http://127.0.0.1/mogujie/Static/Home/css/cart.css"/>
		 <script src="http://127.0.0.1/mogujie/Static/js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
		 <script type="text/javascript">
			$(function(){
				$('.plues').click(function(){
					var num = parseInt($(this).siblings('.number').val());
					num=num+1;
					
					var index=$(this).index();
					
					$(this).siblings('.number').val(num);
					var sid = $(this).parents('.carlist').find('.sid').attr('sid'); 
					var total = $(this).parents('.carlist').find('.totalPrice');
					
					$.ajax({
						type:"post",
						url:"<?php echo U('AddDel');?>",
						data:{num:num,sid:sid},
						dataType:'json',
						success:function(phpData){
							total.html(phpData.total);
							$('.over_right_2').html(phpData.totalall+"元");
							$(".totalPrice").eq(index).html(phpData.total);
							$(".rows").html(phpData.total_rows);
							}
						});
					});
					

				$('.reduce').click(function(){
					var num=parseInt($(this).siblings('.number').val());
					if(num==1){
						return false;
					}
					num=num-1;
					$(this).siblings('.number').val(num);
					var index=$(this).index();
					var sid = $(this).parents('.carlist').find('.sid').attr('sid'); 
					var total = $(this).parents('.carlist').find('.totalPrice');
					$.ajax({
						type:"post",
						url:"<?php echo U('AddDel');?>",
						data:{num:num,sid:sid},
						dataType:'json',
						success:function(phpData){
							total.html(phpData.total);
							$('.over_right_2').html(phpData.totalall+"元");
							$(".totalPrice").eq(index).html(phpData.total);
							$(".rows").html(phpData.total_rows);
							}
						});
				})
				
			})
		</script>
	</head>
<body>
<!--顶部红色部分-->
<div id="top_red">
	<div class="pic">
		<div class="pic_l">
			<a href="">蘑菇街首页</a>
		</div>
		<ul class="pic_r">
			    <?php if($hd['session']['username'] && $hd['session']['uid']){ ?>
				<li class='userinfo'>
					欢迎回来<a href="<?php echo U('Search/index');?>" class='uname' style="margin-right:10px ;"><?php echo $hd['session']['username'];?></a>
				</li>
				<li class="sp">|</li>
				<li><a href="<?php echo U('Login/out');?>">退出</a></li>  
			<?php }else{ ?>
				<li><a href="<?php echo U('Register/index');?>">注册</a></li>
				<li><a href="<?php echo U('Login/index');?>">登陆</a></li>
			<?php } ?>
			<li><span>|</span><a href="">QQ登陆</a></li>
			<li><a href="">微信登陆</a></li>
			<li><a href="">微博登陆</a></li>
			<li><span>|</span><a href="">手机蘑菇街</a></li>
			<li><span>|</span><a href="">帮助中心</a></li>
		</ul>
	
	</div>
</div>
<!--顶部红色区域结束-->
<div id="arrange">
	<a href="<?php echo U('Index/index');?>"><p></p></a>
	<div class="arr_right">
		<div class="arr_r_l">
			<div class="one">1</div>
		</div>
		<div class="arr_r_r">
			
			<div class="two">2</div>
			<div class="three">3</div>
			<div class="four">✔</div>
			<span class="sp_1">购物车</span>
			<span class="sp_2">确认订单</span>
			<span class="sp_3">支付</span>
			<span class="sp_4">完成</span>
		</div>
	</div>
</div>
<hr />
<!--全部商品-->
<div id="cartslide">
	<ul>
		<li class="num_f"><a href="">全部商品 (<span class="rows"><?php echo $data['total_rows'];?></span>)</a></li>
		<p>|</p>
		<li><a href="">优惠 (<span>1</span>)</a></li>
		<p>|</p>
		<li><a href="">库存紧张 (<span>0</span>)</a></li>
	</ul>
</div>
<div id="box">
	<table border="0" cellspacing="0" cellpadding="0">
		<tr height="50">
			<th width="66">
				<!--<input type="checkbox" name="" id="quanx" value=""/>
				<label for="quanx">全选</label>-->
			</th>
			<th width="300">商品</th>
			<th width="140">商品信息</th>
			<th width="200">单价(元)</th>
			<th width="260">数量</th>
			<th width="100">小计(元)</th>
			<th width="80">操作</th>
		</tr>
		<tr height="50">
			<th width="66">
				<!--&nbsp;<input type="checkbox" name="" id="dianp" value="" />-->
				<label for="dianp">店铺</label><span>:</span>
			</th>
			<th width="300" style="text-align: left;" class="bg"><a href="">Kare 卡兰</a></th>
			<th width="140"></th>
			<th width="200"></th>
			<th width="260"></th>
			<th width="180" colspan="2" style="text-indent: 40px;">全店铺满2件减3元</th>
		</tr>
		<?php foreach ($data['goods'] as $k=>$v){?>
		<tr height="50" class="carlist">
			<th width="66">
				<!--<input type="checkbox" name="" id="quanx" value="" />-->
				<label for="quanx">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
			</th>
			<th width="300">
				<a href=""><img src="http://127.0.0.1/mogujie/<?php echo $v['options']['pic'];?>" alt="" /></a>
				<a href="" class="aa sid" sid='<?php echo $k;?>'><?php echo $v['name'];?></a>
			</th>
			<th width="140"><span><?php echo $v['options']['color'];?> </span></th>
			<th width="200">
				<span class="m_first">原价</span><br />
				<span class="m_middle"><?php echo $v['price'];?></span><br />
				<!--<span class="m_last">促销7.0折 </span>-->
			</th>
			<!--<th width="260"><?php echo $v['num'];?></th>-->
			<th>
				<a href="javascript:;" class="reduce">-</a>
				<input type="text" name="num" class="number" value="<?php echo $v['num'];?>" />
				<a href="javascript:;" class="plues">+</a>
			</th>
			<th width="100" class="totalPrice"><?php echo $v['total'];?></th>
			<th width="80"><a href="<?php echo U('delGoods',array('sid'=>$k));?>">删除</a></th>
		</tr>
		<?php }?>
	</table>
</div>
<div id="over">
	<div class="over_left">
		<p>
			<!--<input type="checkbox" name="" id="quanx" value="" />
			<label for="quanx"><a href="">全选</a></label>
			<a href="">删除 </a>-->
			<!--<a href="">清空失效商品</a>-->
		</p>
	</div>
	<div class="over_right">
		<div class="over_right_1">共有<span class="rows"><?php echo $data['total_rows'];?></span>件商品，总计：</div>
		<div class="over_right_2"><?php echo $data['total'];?>元</div>
		<a href="<?php echo U('Order/index');?>"><div class="over_right_3"></div></a>
	</div>
</div>
<!-- 底部文字 -->
<div id="b_font">
	<div class="bb_font">
		<div class="b_font_l">
			<a href="" class="bone"></a>
			<p>营业执照注册号：<a href="">330106000129004</a></p>
			<p>增值电信业务经营许可证：<a href="">浙B2-20110349</a></p>
			<p>ICP备案号：浙ICP备10044327号-3</p>
			<p>©2015 Mogujie.com 杭州卷瓜网络有限公司</p>		
		</div>
		<div class="b_font_r">
			<dl>
				<dt>公司</dt>
				<dd><a href="">关于我们</a></dd>
				<dd><a href="">招聘信息</a></dd>
				<dd><a href="">联系我们</a></dd>
			</dl>  

			<dl>
				<dt>消费者</dt>
				<dd><a href="">帮助中心</a></dd>
				<dd><a href="">意见反馈</a></dd>
				<dd><a href="">手机版下载</a></dd>
			</dl>
			<dl>
				<dt>商家</dt>
				<dd><a href="">免费开店</a></dd>
				<dd><a href="">商家入驻</a></dd>
				<dd><a href="">管理后台</a></dd>
			</dl>
			<dl class="llast">
				<dt>权威认证</dt>
				<dd>
					<a href="" class="llast-1"></a>
					<a href="" class="llast-2"></a>
					<a href="" class="llast-3"></a>
				</dd>
			</dl>
		</div>
	</div>
</div>




<!-- 底部文字结束 -->
</body>
</html>
